package xyz.fefine;

import java.util.List;

/**
 * Created by feng_ on 2016/9/8.
 * code block
 * 添加return
 */
public class BlockStmnt extends ASTList{
    public BlockStmnt(List<ASTree> list) {
        super(list);
    }

    @Override
    public Object eval(Enviorment enviorment) {
        Object res = null;
        //需要判断是否为return语句


        // 需要把里面的全部进行执行一遍 直接调用super就行
        for (ASTree asTree : children) {
            res = asTree.eval(enviorment);
//            System.out.println(asTree+"--->"+res);
        }
        //返回值返回最后一个结果
        return res;
    }
}
